<template>
  <div>
    <el-table
      :data="tableData"
      :inline="true"
      border
      style="width: 100%"
      align="center"
    >
      <el-table-column prop="name" label="姓名" :show-overflow-tooltip="true" />
      <el-table-column
        prop="modelName"
        label="业务类型"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        prop="basicLoansMoney"
        label="订单收入"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        prop="haveAccount"
        label="服务费"
        :show-overflow-tooltip="true"
      />
      <el-table-column label="操作" fixed="right" width="120" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="lookUp(scope.row)"
            >查看</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { exportOrder, getTbleadgUrl } from "@/assets/js/api";
export default {
  props: {
    diaId: {
      type: Number
    }
  },
  data() {
    return {
      tableData: []
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 请求数据
    getList() {
      exportOrder(this.diaId).then(res => {
        this.tableData = res.data;
      });
    },
    // 查看
    /**
     * 
     已录入 ---0
     审批中 ---1
     待交件 ---2
     待放款 ---3
     已放款 ---4
     已回款 ---5
     已中止 ---6
     */
    lookUp(obj) {
      getTbleadgUrl({
        orderNumber: obj.orderNumber
      }).then(res => {
        if (res.code == 200 && res.data != null) {
          //已录入
          let inputUrl = res.data.inputUrl;
          //待审批
          let examineUrl = res.data.examineUrl;
          //待交件
          let submintUrl = res.data.submintUrl;
          //待放款页面
          let lendingUrl = res.data.lendingUrl;
          //已放款
          let aleradyURL = res.data.aleradyURL;
          //归档页面,中止
          let pigeonholeUrl = res.data.pigeonholeUrl;
          sessionStorage.setItem("orderNumber", obj.orderNumber);
          sessionStorage.setItem("orderStatus", obj.orderStatus);
          sessionStorage.setItem("markUpdate", obj.markUpdate);
          switch (obj.orderStatus) {
            case 1:
              this.$router.push(examineUrl);
              break;
            case 2:
              this.$router.push(submintUrl);
              break;
            case 3:
              //待放款
              this.$router.push(lendingUrl);
              break;
            case 4:
              //跳转已放款页面
              this.$router.push({
                path: aleradyURL,
                query: { Restatus: true, status: false }
              });
              break;
            case 5:
              //跳转已归档页面
              this.$router.push(pigeonholeUrl);
              break;
            case 6:
              //跳转已中止页面
              this.$router.push(pigeonholeUrl);
              break;
            default:
              this.$router.push({
                path: inputUrl
              });
          }
        }
      });
    }
  }
};
</script>

<style scoped lang="less"></style>
